/**
 * @file   AbstractDataType.cpp
 * @author Djuro Drljaca (djurodrljaca@gmail.com)
 * @date   2014-04-18
 * @brief  Base object for a DON data type.
 *
 * Copyright 2014  Djuro Drljaca (djurodrljaca@gmail.com)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <DON/Core/DataType/AbstractDataType.h>
#include <DON/Core/DataType/Boolean.h>
#include <DON/Core/DataType/Int8.h>
#include <DON/Core/DataType/UInt8.h>
#include <DON/Core/DataType/Int16.h>
#include <DON/Core/DataType/UInt16.h>
#include <DON/Core/DataType/Int32.h>
#include <DON/Core/DataType/UInt32.h>
#include <DON/Core/DataType/Int64.h>
#include <DON/Core/DataType/UInt64.h>
#include <DON/Core/DataType/Float32.h>
#include <DON/Core/DataType/Float64.h>
#include <DON/Core/DataType/String.h>
#include <DON/Core/DataType/Date.h>
#include <DON/Core/DataType/Time.h>
#include <DON/Core/DataType/Structure.h>
#include <DON/Core/DataType/Array.h>
#include <DON/Core/DataType/Custom.h>

using namespace DON::Core::DataType;

AbstractDataType::~AbstractDataType()
{
}

AbstractDataType * AbstractDataType::createInstance(const DataType dataType)
{
    AbstractDataType *instance = NULL;

    switch (dataType)
    {
        case DataType_Boolean:
        {
            instance = new Boolean();
            break;
        }

        case DataType_Int8:
        {
            instance = new Int8();
            break;
        }

        case DataType_UInt8:
        {
            instance = new UInt8();
            break;
        }

        case DataType_Int16:
        {
            instance = new Int16();
            break;
        }

        case DataType_UInt16:
        {
            instance = new UInt16();
            break;
        }

        case DataType_Int32:
        {
            instance = new Int32();
            break;
        }

        case DataType_UInt32:
        {
            instance = new UInt32();
            break;
        }

        case DataType_Int64:
        {
            instance = new Int64();
            break;
        }

        case DataType_UInt64:
        {
            instance = new UInt64();
            break;
        }

        case DataType_Float32:
        {
            instance = new Float32();
            break;
        }

        case DataType_Float64:
        {
            instance = new Float64();
            break;
        }

        case DataType_String:
        {
            instance = new String();
            break;
        }

        case DataType_Date:
        {
            instance = new Date();
            break;
        }

        case DataType_Time:
        {
            instance = new Time();
            break;
        }

        case DataType_Structure:
        {
            instance = new Structure();
            break;
        }

        case DataType_Array:
        {
            instance = new Array();
            break;
        }

        case DataType_Custom:
        {
            instance = new Custom();
            break;
        }

        default:
        {
            instance = NULL;
            break;
        }
    }

    return instance;
}
